def getProto(defc):
  code=defc.chain(['code']).deref()
  try:
    proto=defc.chain(['protocode'])
  except:
    proto=rewrite(code)
    defc['protocode']=proto
  return proto

def rewrite(code):
